<!DOCTYPE html>
<html lang="en">
<head>
	<link rel="shortcut icon" href="#" />
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>模板字符串</title>
</head>
<body>
	<div>引用变量是$加上大括号</div>
	<script type="text/javascript">
		let name = `张三`
		let sayHello = `Hello ${name}`
		console.log(sayHello)

		let result = {
			name: "zhangsan",
			age: 20
		}
		let htmla = 
			`<div>
				<span>${result.name}</span>
				<span>${result.age}</span>
			</div>`
		console.log(htmla)

		const fn = () => {
			return '我是fn函数'
		}
		let html = `我是模板字符串 ${fn()}`
		console.log(html)
	</script>
</body>
</html>